#include "CImg.h"
#include <fstream>

using namespace cimg_library; 
using namespace std;


int main(){

	ifstream range;
	range.open("range.txt"); // top left- bottom right;
	int top, bottom, left, right;
	range >> top >> left >> bottom >> right;
	range.close();

	CImg<int> my_image( right-left+1, bottom-top+1, 1, 3, 0);	// respectively stand for x, y, z, #chanel & fill_value

	ifstream map_txt;
	int land_cover;

	// map by every_pixels
	/*
	map_txt.open("maps.txt");
	for ( int y = top-top ; y <= bottom-top ; y++ )
	{
		for ( int x = left-left ; x <= right-left ; x++ )
		{			
			land_cover = 0;
			map_txt >> land_cover;
			if (land_cover != 0 && land_cover != 11){
				my_image(x, y, 0, 0) = land_cover*255/16;
				my_image(x, y, 0, 1) = land_cover*255/16;
				my_image(x, y, 0, 2) = land_cover*255/16;
			}
		}
	}
	*/

	// maps by selected_pixels_only
	map_txt.open("input.txt");

	int number_gt_pt, line, sample;
	map_txt >> number_gt_pt;
	for (int i = 0; i < number_gt_pt; ++i)
	{
		map_txt >> line >> sample;
		my_image(line - left, sample - top, 0, 0) = 255;
		my_image(line - left, sample - top, 0, 1) = 255;
		my_image(line - left, sample - top, 0, 2) = 255;
	}

	map_txt.close();

	my_image.save("maps.bmp");

	return 0; 
} 
